package com.commonClass.packagingClass;

public class TestPackaging {
    public static void main(String[] args) {
        //输出int 类型能表示的最大值
        System.out.println(Integer.MAX_VALUE);//2147483647
        //利用Integer的构造方法赋值
        Integer i1 = new Integer(100);
        System.out.println("i1的值: "+i1);//100

        Integer i2 = new Integer("100");//这里的字符串只能为数字
        System.out.println("i2的值: "+i2);//100

        int i3 = i2.intValue();//Integer转int类型
        System.out.println("i3的值: "+i3);//100

        Integer i4 = Integer.valueOf(8);//int转Integer
        System.out.println("i4的值: "+i4);

        int i5 = Integer.parseInt("1");//利用Integer将数字字符串转int
        System.out.println("i5的值: "+i5);

        //十进制转二进制
        String s1 = Integer.toBinaryString(10);
        System.out.println("s1的值: "+s1);

        //十进制转8进制
        String s2 = Integer.toOctalString(20);
        System.out.println("s2的值: "+s2);

        //十进制转16
        String s3 = Integer.toHexString(10);
        System.out.println("s3的值: "+s3);

        Integer num1 =new Integer(100);
        Integer num2 =new Integer(100);
        System.out.println(num1==num2);//false 内存地址
        System.out.println(num1.equals(num2));//Integer
        // 重写了equals()方法if (obj instanceof Integer)
        // {return value == ((Integer)obj).intValue();}


    }
}

    